# import sqlite3
# class bank():
#     def creatit(self):
#      db=sqlite3.connect("d://zhuanjiadatabase.db")
#      db.cursor()
#      sql = u"create table if not exists duiying(zheng1 char(40),jieguo char(20))"
#      work = db.execute(sql)
#      return work,db
#     def insertit(self,inp):
#         aa = self.creatit()
#         aa[1].execute("INSERT INTO duiying(zheng1,jieguo) VALUES(?,?)",(inp[0],inp[1]))
#         aa[1].commit()
#         aa[1].close()
#     def insertthem(self):
#         a= [("毛囊皮根微红肿","轻型")
#         ,("鼻塞流涕","外感风热")
#         ,("舌苔薄黄 胃纳差","胃肠积热")
#         ,("眼睑局部明显红肿","重型")
#         ,("眼睑局部红肿 顶尖有脓点","重型")
#         ,("重型 脓点破溃","晚期")
#         ,("轻型 外感风热","轻风热型")
#         ,("重型 外感风热","重风热型")
#         ,("重型 胃肠积热","重积热型")
#         ,("轻型","散瘌法")
#         ,("晚期","外敷药物")
#         ,("轻风热型","散瘌加罐")
#         ,("重风热型","挑瘌加罐")
#         ,("重积热型","放血法")]
#         for li in a:
#             self.insertit(li)
#         return
#     def getall(self):
#         aa = self.creatit()
#         cur =aa[1].cursor()
#         cur.execute('select * from duiying')
#         res = cur.fetchall()
#         cur.close()
#         return res
#     def xunzhao(self):
#         a=input('输入所有症状').split(" ")
#         res = self.getall()
#         nu = 0
#         nu1 = 0
#         x= 1
#         for x in [1]:
#          for nu in [0] :
#           for line in res:
#             # print("鼻塞流涕 眼睑局部明显红肿", a)
#             # print("zj",line[0].split(" "))
#             if set(line[0].split(" ")) < set(a):
#                a.append(line[1])
#
#                nu = 0
#             else:
#                nu1 += 1
#             if nu1 == len(res):
#                 nu+=1
#         if "晚期" in a:
#             print("外敷药物治疗")
#         elif "重型" in a:
#             if "重风热型" in a:
#                 print("挑瘌加罐治疗")
#             elif "重积热型" in a:
#                 print("放血法治疗")
#             else :
#                 print("不会治疗，退出输入1或重新输入输入0")
#                 if int(input()) :
#                     return
#         elif "轻型" in a:
#             if "轻风热型" in a:
#                 print("散瘌加罐治疗")
#             else :
#                 print("散瘌法治疗")
#         else:
#             if  int(input("您的症状与麦粒肿无关，按0重新输入，按1退出")):
#                 return
#         if  int(input("治疗结束按1退出，按0重新开始")):
#                 return
# a = bank()
# a.insertthem()
# a.xunzhao()
biaos=['DIM','DO','IF','STOP','END']
zimu = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s'
    ,'t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
def isdig(a):
    if a >='0' and a <= '9':
        return True
    else:
        return False
def isnum(a):
    if a in zimu:
        return True
    else:
        return False
def realize(str):
    i=0
    a = []
    dian = ''
    while i<len(str) :
        if isdig(str[i]):
            dian+=str[i]
            i+=1
            while isdig(str[i]):
                dian+=str[i]
                i += 1
            a.append(('INT',dian))
            dian=''
        elif isnum(str[i]):
            dian += str[i]
            i += 1
            while isnum(str[i]) or isdig(str[i]):
                dian += str[i]
                i += 1
            if dian in biaos:
                a.append((dian,' '))
            else:
                a.append(('id',dian))
        elif str[i] == '+':
            i+=1
            a.append(('+','  '))
        elif str[i] == '=':
            i += 1
            a.append(('=','  '))
        elif str[i] == ',':
            i += 1
            a.append((',','  '))
        elif str[i] == '(':
            i += 1
            a.append(('(','  '))
        elif str[i] == ')':
            i += 1
            a.append((')','  '))
        elif str[i] == '*':
            i+=1
            if str[i] =='*':
                a.append(("**","  "))
            else:
                a.append(("*","  "))
            i+=1
        elif str[i] == ' ':
            i+=1
        else:
            return False




